fix(oxfmt): Skip vite.config.ts w/o .fmt field in auto-discovery#20254
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Pull request overview
This PR adjusts oxfmt config auto-discovery so that vite.config.ts is only treated as an Oxfmt config when it contains the expected .fmt field, while keeping explicit --config vite.config.ts strict (erroring if .fmt is missing).
Changes:
- Split explicit config loading vs upward auto-discovery, and add “skip vite.config.ts without
.fmt” behavior during auto-discovery. - Plumb
config_dir(not “config path”) into the walker soignorePatternsresolve relative to the loaded config directory. - Extend CLI snapshot tests/fixtures to cover explicit-error vs auto-discovery-skip behavior (including “skip child vite config, find parent config”).
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| apps/oxfmt/src/core/config.rs | Implements explicit-load vs auto-discovery; skips vite.config.ts without .fmt; adds config_dir() accessor. |
| apps/oxfmt/src/cli/format.rs | Switches to ConfigResolver::from_config for discovery; uses config_dir() for ignorePatterns and “no config” hint logic. |
| apps/oxfmt/src/cli/walk.rs | Changes ignorePatterns root from config file path to config_dir. |
| apps/oxfmt/src/stdin/mod.rs | Routes --config directly into ConfigResolver::from_config (no separate path resolver). |
| apps/oxfmt/src/lsp/server_formatter.rs | Removes resolve_oxfmtrc_path usage; passes optional config path directly to ConfigResolver::from_config. |
| apps/oxfmt/src/core/mod.rs | Stops exporting the removed resolve_oxfmtrc_path. |
| apps/oxfmt/test/cli/vite_config/vite_config.test.ts | Adds test cases for explicit --config error vs auto-discovery skip behavior. |
| apps/oxfmt/test/cli/vite_config/snapshots/vite_config.test.ts.snap | Updates/adds snapshots for the new CLI behaviors. |
| apps/oxfmt/test/cli/vite_config/fixtures/skip_finds_parent/** | Adds fixtures to validate skipping child vite.config.ts and finding a parent .oxfmtrc.json. |
You can also share your feedback on Copilot code review. Take the survey.
vite.config.ts w/o .fmt field in auto-discovery
2308d45 to
079cd61
Compare
Merge activity
|
079cd61 to
11a2b45
Compare
# Oxlint ### 🐛 Bug Fixes - 4ea67de oxlint,oxfmt: Skip `vite.config.ts` exports `defineConfig(fn)` (#20260) (leaysgur) - cc89dbf oxlint: Skip `vite.config.ts` w/o `.lint` field in auto-discovery (#20255) (leaysgur) - 89b7ca9 linter/no-duplicate-imports: Only check aggregated exports (#20178) (kennytm) - 691f556 linter/explicit-module-boundary-types: Ignore constructor callbacks (#20221) (camc314) ### ⚡ Performance - d160dca linter/plugins: Reduce array lookups in visitor compilation (#20249) (overlookmotel) ### 📚 Documentation - 0c7da4f linter: Fix extra closing brace in example config. (#20253) (connorshea) - 13606c3 linter/plugins: Update conformance README (#20234) (overlookmotel) # Oxfmt ### 🐛 Bug Fixes - 4ea67de oxlint,oxfmt: Skip `vite.config.ts` exports `defineConfig(fn)` (#20260) (leaysgur) - 11a2b45 oxfmt: Skip `vite.config.ts` w/o `.fmt` field in auto-discovery (#20254) (leaysgur) Co-authored-by: leaysgur <6259812+leaysgur@users.noreply.github.com>
|
I believe I'm still hitting the issue that this was meant to solve with oxfmt v0.40.0. This is in a monorepo with a root-level Let me know if it would be helpful to put together a minimal reproduction. |
|
can you sure your vite config @jamesbvaughan |
|
I've spent some time trying to narrow down the issue and found that the content of I believe I've narrowed the problem down to something involving either Volta or differences in Node versions. I have a minimal repro in a repo with this structure: Where the root {
"name": "oxfmt-issue-demo",
"workspaces": {
"packages": [
"apps/*"
]
},
"type": "module",
"devDependencies": {
"oxfmt": "^0.40.0"
},
"volta": {
"node": "22.16.0"
},
"packageManager": "yarn@4.13.0"
}It doesn't matter what's in |
|
Actually it seems that this will be fixed in the next release for me. The change in this PR fixed my issue: #20326 |

Fixes #20237